package com.zdb.demo.design.pattern.structural.facade;

public class PointsGiftExchangeService {

    private QualifyService qualifyService = new QualifyService();
    private PointsPaymentService pointsPaymentService = new PointsPaymentService();
    private ShippingService shippingService = new ShippingService();


    public String exchangeGift(PointsGift pointsGift) {
        if(qualifyService.isAvailable(pointsGift)) {
            if(pointsPaymentService.pay(pointsGift)) {
                String orderNo = shippingService.shipGift(pointsGift);
                System.out.println("积分礼物" + pointsGift.getName() + " 兑换成功,物流订单为：" + orderNo);
                return orderNo;
            }
        }
        return null;
    }
}
